package com.cskaoyan.bean.wx_coupon;

import com.cskaoyan.bean.promotion.coupon.Coupon;
import com.cskaoyan.util.DateUtils;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description:
 * @Author: WD created on 2021-09-21 16:57
 * @Version:
 */

@Data
@NoArgsConstructor
public class WXCouponListInnerCoupon {

    private Integer id;
    private String name;
    private String desc;
    private String tag;
    private Double discount;
    private Double min;
    private Short days;
    private String startTime;
    private String endTime;


    public WXCouponListInnerCoupon(Coupon coupon) {
        this.id = coupon.getId();
        this.name = coupon.getName();
        this.desc = coupon.getDesc();
        this.tag = coupon.getTag();
        this.discount = coupon.getDiscount();
        this.min = coupon.getMin();

        if (coupon.getGoodsType() == 0) {
            this.days = coupon.getDays();
        } else {
            this.days = 0;
            this.startTime = DateUtils.dateFormat(coupon.getStartTime());
            this.endTime = DateUtils.dateFormat(coupon.getEndTime());
        }
    }
}
